package com.github.soiff.shadow.plugin.helper;

import com.github.jknack.handlebars.Helper;
import com.github.jknack.handlebars.Options;

import java.io.IOException;

import static com.github.soiff.shadow.plugin.utils.Constants.DECIMAL_FORMAT;

/**
 * Created by Soiff on 2016/05/20.
 *
 * @author : Soiff
 */
public class FormatIntegerRateHelper implements Helper<Integer> {
    @Override
    public CharSequence apply(Integer rate, Options options) throws IOException {
        return rate == null?"":DECIMAL_FORMAT.format((double)rate.intValue() / 1000.0D);
    }
}
